<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>nreverb</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="notnum.html" title="notnum" />
    <link rel="next" href="nrpn.html" title="nrpn" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">nreverb</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="notnum.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="nrpn.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="nreverb"></a>
      <div class="titlepage"></div>
      <a id="IndexNreverb" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">nreverb</span>
        </h2>
        <p>nreverb — 
      A reverberator consisting of 6 parallel comb-lowpass filters.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp127700032"></a>
        <h2>Description</h2>
        <p>
      This is a reverberator consisting of 6 parallel comb-lowpass filters being fed into a series of 5 allpass filters. <span class="emphasis"><em>nreverb</em></span> replaces <a class="link" href="reverb2.html" title="reverb2"><em class="citetitle">reverb2</em></a> (version 3.48) and so both opcodes are identical.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp127702896"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>nreverb</strong></span> asig, ktime, khdif [, iskip] [,inumCombs] [, ifnCombs] \
      [, inumAlpas] [, ifnAlpas]</pre>
      </div>
      <div class="refsect1">
        <a id="idp127773168"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>iskip</em></span> (optional, default=0) -- Skip initialization if present and non-zero.
    </p>
        <p>
      <span class="emphasis"><em>inumCombs</em></span> (optional) -- number of filter constants in comb filter. If omitted, the values default to the nreverb constants. New in Csound version 4.09.
    </p>
        <p>
      <span class="emphasis"><em>ifnCombs</em></span> - function table with <span class="emphasis"><em>inumCombs</em></span> comb filter time values, followed the same number of gain values.  The ftable should not be rescaled (use negative fgen number). Positive time values are in seconds. The time values are converted internally into number of samples, then set to the next greater prime number. If the time is negative, it is interpreted directly as time in sample frames, and no processing is done (except negation). New in Csound version 4.09.
    </p>
        <p>
    <span class="emphasis"><em>inumAlpas</em></span>, <span class="emphasis"><em>ifnAlpas</em></span> (optional) -- same as <span class="emphasis"><em>inumCombs/ifnCombs</em></span>, for allpass filter. New in Csound 4.09.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp127779968"></a>
        <h2>Performance</h2>
        <p>
      The input signal asig is reverberated for <span class="emphasis"><em>ktime</em></span> seconds. The parameter <span class="emphasis"><em>khdif</em></span> controls the high frequency diffusion amount. The values of <span class="emphasis"><em>khdif</em></span> should be from 0 to 1. If <span class="emphasis"><em>khdif</em></span> is set to 0 the all the frequencies decay with the same speed. If <span class="emphasis"><em>khdif</em></span> is 1, high frequencies decay faster than lower ones. If <span class="emphasis"><em>ktime</em></span> is inadvertently set to a non-positive number, <span class="emphasis"><em>ktime</em></span> will be reset automatically to 0.01. (New in Csound version 4.07.)
    </p>
        <p>
    As of Csound version 4.09, <span class="emphasis"><em>nreverb</em></span> may read any number of comb and allpass filter from an ftable.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp127785680"></a>
        <h2>Examples</h2>
        <p>
      Here is a simple example of the nreverb opcode. It uses the file <a class="ulink" href="examples/nreverb.csd" target="_top"><em class="citetitle">nreverb.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp127787552"></a>
          <p class="title">
            <strong>Example 545. Simple example of the nreverb opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o nreverb.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Initialize the global variables.</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

gaout <span class="opc">init</span>  0

<span class="oblock">instr</span> 1
a1	<span class="opc">oscil</span>	15000, 440, 1
	<span class="opc">out</span>	a1
 
gaout <span class="op">=</span> gaout<span class="op">+</span>a1
<span class="oblock">endin</span>

<span class="oblock">instr</span> 99

a2	<span class="opc">nreverb</span>	gaout, 2, .3
	<span class="opc">out</span>	a2<span class="op">*</span>.15		<span class="comment">;volume of reverb		</span>
	 
gaout <span class="op">=</span> 0
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="comment">; Table 1: an ordinary sine wave.</span>
<span class="stamnt">f</span> 1 0 32768 10 1 
         
<span class="stamnt">i</span> 1 0 .5
<span class="stamnt">i</span> 1 1 .5
<span class="stamnt">i</span> 1 2 .5
<span class="stamnt">i</span> 1 3 .5
<span class="stamnt">i</span> 1 4 .5
<span class="stamnt">i</span> 99 0 9 
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
        <p>
      Here is an example of the nreverb opcode using an ftable for filter constants. It uses the file <a class="ulink" href="examples/nreverb_ftable.csd" target="_top"><em class="citetitle">nreverb_ftable.csd</em></a>, and <a class="ulink" href="examples/beats.wav" target="_top"><em class="citetitle">beats.wav</em></a>.
      </p>
        <div class="example">
          <a id="idp127793792"></a>
          <p class="title">
            <strong>Example 546. An example of the nreverb opcode using an ftable for filter constants.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o nreverb_ftable.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Initialize the global variables.</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="oblock">instr</span> 1
  a1  <span class="opc">soundin</span> "beats.wav"
  a2  <span class="opc">nreverb</span> a1, 1.5, .75, 0, 8, 71, 4, 72
  <span class="opc">out</span> a1 <span class="op">+</span> a2 <span class="op">*</span> .4
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="comment">; freeverb time constants, as direct (negative) sample, with arbitrary gains</span>
<span class="stamnt">f</span>71 0 16   -2  -1116 -1188 -1277 -1356 -1422 -1491 -1557 -1617  0.8  0.79  0.78  0.77  0.76  0.75  0.74  0.73

<span class="stamnt">f</span>72 0 16   -2  -556 -441 -341 -225  0.7  0.72  0.74  0.76

<span class="stamnt">i</span>1 0 3
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp127795744"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Authors: Paris Smaragdis (<span class="emphasis"><em>reverb2</em></span>)</td>
          </tr>
          <tr>
            <td>MIT, Cambridge</td>
          </tr>
          <tr>
            <td>1995</td>
          </tr>
        </table>
        <p>
    </p>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Richard Karpen (<span class="emphasis"><em>nreverb</em></span>)</td>
          </tr>
          <tr>
            <td>Seattle, Wash</td>
          </tr>
          <tr>
            <td>1998</td>
          </tr>
        </table>
        <p>
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="notnum.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="nrpn.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">notnum </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> nrpn</td>
        </tr>
      </table>
    </div>
  </body>
</html>
